package com.joker.demo.controller;


import dev.langchain4j.model.chat.ChatModel;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 大模型/hello入口
 *
 * @author : feixiang.li
 * @since : 2025-09-25 14:57
 */
@Slf4j
@RestController
@RequestMapping("/hello")
public class HelloController {


    @Resource
    private ChatModel chatLanguageModel;


    /**
     * 简单问问题
     *
     * @param question
     * @return
     */
    @RequestMapping("/question")
    public String question(@RequestParam(value = "question", defaultValue = "你是谁") String question) {
        log.info("question:{}", question);
        String chat = chatLanguageModel.chat(question);
        log.info("chat:{}", chat);
        return chat;
    }
}
